package kr.hkit.powerjava.chapter12.poly;

import java.util.Random;

public class ShapeTest {
	private static Shape[] arrOfShape;
	private static Movable[] arrOfMovable;
	private static Drawable[] arrOfDrawable;
	public static void main(String[] args) {
		initMove();
		moveAll();
		System.out.println();
		initDraw();
		drawAll();
	}
	
	public static void initDraw() {
		arrOfDrawable = new Drawable[3];
		arrOfDrawable[0] = new Rectangle();
		arrOfDrawable[1] = new Triangle();
		arrOfDrawable[2] = new Circle();
	}
	
	
	public static void drawAll() {
		for(int i = 0; i < arrOfDrawable.length; i++ ) {
			arrOfDrawable[i].draw();
		}
		
	}
	
	public static void initMove() {
		arrOfMovable = new Movable[3];
		arrOfMovable[0] = new Rectangle();
		arrOfMovable[1] = new Triangle();
		arrOfMovable[2] = new Circle();
	}
	
	public static void moveAll() {
		Random rd = new Random();
		for (int i = 0; i < arrOfMovable.length; i++) {
			arrOfMovable[i].move(rd.nextInt(100), rd.nextInt(100));
		}
	}

}
